/*
 * 版权所有 ( c ) 联想集团有限公司 2005-2009 保留所有权利。
 * 项目：	Lenovo Push Service
 * 文件名：	Dao.java
 * 版本:    1.0
 * 描述：	Defines common interface for data access
 * 作者：	刘兵召
 * 日期：	2009-7-10
 * 修改历史：
 * 【时间】		【修改者】	【修改内容】
 */
package com.feng.demo.hibernate.jta.orm.dao;

import java.sql.Connection;

/**
 * Interface that defines common methods used by data access.
 *
 */
public interface Dao{

   /**
    * Get connection used
    *
    * @return connection
    */
   public Connection getConnection();
   
   /**
    * Close connection used
    */ 
   public void closeConnection() throws DaoException;
   
   /**
    * Begin transaction
    */ 
   public void beginTransaction() throws DaoException;
   
   /**
    * Begin transaction
    *
    */
   public void commitTransaction() throws DaoException;
   
   /**
    * Rollback transaction
    */
   public void rollbackTransaction() throws DaoException;
   
   /**
    * Check if auto commit is set
    *
    * @return Auto commit flag
    */
   public boolean isAutoCommit();
   
   /**
    * Set auto commit flag
    *
    * @param autoCommit
    */
   public void setAutoCommit(boolean autoCommit);

   /**
    * Check if auto close session is set
    *
    * @return Auto close session flag
    */
   public boolean isAutoCloseSession();

   /**
    * Set auto close session flag
    *
    * @param autoClose
    */
   public void setAutoCloseSession(boolean autoClose);
   
   /**
    * Close session
    *
    */
   public void closeSession() throws DaoException;
   
   /**
    * Flush session
    *
    * @return
    */
   public void flushSession() throws DaoException;
   
   /**
    * Clear session
    *
    */
   public void clearSession() throws DaoException;
}